package tv.acgn.advertisement.index.po;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

/**
 * @program: advertisement-ad-pub-po
 * @description: 创意-推广单元 关联
 * @author: junG
 * @create: 2019-04-30 00:03
 **/

@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "ad_creative_unit")
@Entity
@DynamicInsert
@DynamicUpdate
public class CreativeUnitPO {

    @Id
    @Column(name = "creative_unit_id", nullable = true, unique = true, length = 64)
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    private String creativeUnitId;

    /**
     * 关联创意素材识别码 值只允许 {@link CreativePO} 中包含creativeId的值
     */
    @Column(name = "creative_id", nullable = false)
    private String creativeId;

    /**
     * 关联推广单元识别码 值只允许 {@link AdUnitPO} 中包含unitId的值
     */
    @Column(name = "unit_id", nullable = true)
    private String unitId;

    public CreativeUnitPO(String creativeId, String unitId) {
        this.creativeId = creativeId;
        this.unitId = unitId;
    }
}
